package cn.edu.seu.ssny.entity;

import com.alibaba.fastjson.annotation.JSONField;
import cn.edu.seu.ssny.entity.support.BaseEntity;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter

/**
 * 网关表
 */
@Entity
@Table(name = "tb_gateway")
public class Gateway extends BaseEntity {


    /**
     * 项目id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    private Integer id;
    /**
     * 网关名称
     */
    private String name;
    /**
     * 网关标识
     */
    @Column(unique = true)
    private String identification;
    /**
     * 网关地址
     */
    private String address;
    /**
     * 网关版本
     */
    private String version;
    /**
     * 通信接口
     */
    private String communicationInterface;

    /**
     * 备注信息
     */
    private String description;


    @ManyToOne(fetch = FetchType.LAZY, targetEntity = Enterprise.class)
    @JoinColumn(name = "enterprise_id", referencedColumnName = "id")
    private Enterprise enterprise;

    @OneToMany(fetch = FetchType.LAZY, targetEntity = Device.class, mappedBy="gateway")
    @JSONField(serialize = false)
    private List<Device> devices;
}
